﻿using Colorful.Furniture.Localization;
using Volo.Abp.AuditLogging;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;

namespace Colorful.Furniture;

[DependsOn(
    typeof(AbpAuditLoggingDomainSharedModule)
)]
public class FurnitureDomainSharedModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        FurnitureGlobalFeatureConfigurator.Configure();
        FurnitureModuleExtensionConfigurator.Configure();
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpVirtualFileSystemOptions>(options =>
        {
            options.FileSets.AddEmbedded<FurnitureDomainSharedModule>();
        });

        Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Add<FurnitureResource>("zh-Hans")
                .AddVirtualJson("/Localization/Furniture")
                .AddBaseTypes(typeof(FurnitureResource));
        });

        Configure<AbpExceptionLocalizationOptions>(options =>
        {
            options.MapCodeNamespace("Furniture", typeof(FurnitureResource));
        });
    }
}
